///////////////////////////////////////////////////////////////
// File: "CLevelSelectState.cpp"
// Author: Ryan Burkevich (RB)
// Purpose: To contain all level select functionality.
///////////////////////////////////////////////////////////////

#include "CProfileSelectState.h"
#include "../Wrappers/CSGD_DirectInput.h"
#include "../Wrappers/CSGD_TextureManager.h"
#include "CBitmapFontEngine.h"
#include "CProfileManager.h"
#include "CMainMenuState.h"
#include "CGame.h"
#include "CLevelSelectState.h"
#include "CGamePlayState.h"
#include "CWiimote.h"
#include "CTransitionScreen.h"
#include "CCustomizeState.h"
#include "CSoundManager.h"

CProfileSelectState::CProfileSelectState()
{
	m_nUDChoice = 0;
	m_nLRChoice = 0;
	m_nFontID = -1;
	m_nProfileType = 0;
	m_nThemeID = -1;
	m_nProfileChoice = 0;
	m_bItsThemeTime = false;
	m_bFromCustomize = false;
	m_bShowCustomize = false;
	m_bShowCustom = false;
	m_bExitingToGame = false;
	m_bExitingToMain = false;
}

CProfileSelectState::~CProfileSelectState()
{

}

void CProfileSelectState::Enter()
{
	m_cScreen.LoadScreen("Screens/BS_ProfileScreen.xml");

	if(m_bFromCustomize)
	{
		m_nProfileType = SELECTED;
	}
	else
	{	
		if (CProfileManager::GetInstance()->GetNumberOfProfiles() > 4)
		{
			m_nProfileType = OLD;
		}
		else
		{
			m_nProfileType = 0;
		}

		if(CProfileManager::GetInstance()->GetCurrentProfile() != NULL)
		{
			CProfileManager::GetInstance()->GetCurrentProfile()->SetItem(false);
		}
	}

	m_nUDChoice = 0;
	m_nLRChoice = 0;

	m_cTextBox.SetPosX(100);
	m_cTextBox.SetPosY(125);
	m_cTextBox.SetTextLimit(25);

	m_nFontID = CBitmapFontEngine::GetInstance()->LoadFont("BS_TechDemoTitle.xml");
	m_nThemeID = CSGD_TextureManager::GetInstance()->LoadTexture("Resource/BS_All_Images.png");
	m_bItsThemeTime = false;
	m_bExitingToGame = false;
	m_bExitingToMain = false;

}
		
void CProfileSelectState::Exit()
{
	CProfileManager::GetInstance()->SaveProfiles("BS_Profiles.xml");
	m_cScreen.ExitScreen();
	
	m_nUDChoice = 0;
	m_nLRChoice = 0;

	CLevelSelectState::GetInstance()->SetNewLevel(true);
	m_bFromCustomize = false;
	
	m_bExitingToGame = false;
	m_bExitingToMain = false;
}
	
bool CProfileSelectState::Input(float fElapsedTime)
{
	CSGD_DirectInput* pDI = CSGD_DirectInput::GetInstance();
	CProfileManager* pPM = CProfileManager::GetInstance();
	CWiimote* pWii = CWiimote::GetInstance();
	
	if(m_nProfileType == NEW)
	{//New Profile - opens textbox to allow user input
		m_cTextBox.GetInput(fElapsedTime);

		if(!m_cTextBox.GetActive())
		{
			CProfile* cTempProfile = new CProfile();
			if(m_cTextBox.GetText() == NULL)
				return false;
			cTempProfile->SetProfileName(m_cTextBox.GetText());
			pPM->AddProfile(cTempProfile);
			m_cTextBox.ClearText();
			cTempProfile->Release();
			m_nProfileType = OLD;
		}
	}
	else if(m_nProfileType == OLD)
	{//Old Profile - allows the user to use a profile from the list
		if(m_nUDChoice == 0 && (pWii->IsButtonJustPressed(WII_A) || pDI->KeyPressed(DIK_RETURN)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileChoice = 0;
			pPM->SetCurrentProfile(0);
			m_nProfileType = SELECTED;
			m_nLRChoice = 0;
			m_nUDChoice = 0;
		}
		else if(m_nUDChoice == 1 && (pWii->IsButtonJustPressed(WII_A) || pDI->KeyPressed(DIK_RETURN)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileChoice = 1;
			pPM->SetCurrentProfile(1);
			m_nProfileType = SELECTED;
			m_nLRChoice = 0;
			m_nUDChoice = 0;
		}
		else if(m_nUDChoice == 2 && (pWii->IsButtonJustPressed(WII_A) || pDI->KeyPressed(DIK_RETURN)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileChoice = 2;
			pPM->SetCurrentProfile(2);
			m_nProfileType = SELECTED;
			m_nLRChoice = 0;
			m_nUDChoice = 0;
		}
		else if(m_nUDChoice == 3 && (pWii->IsButtonJustPressed(WII_A) || pDI->KeyPressed(DIK_RETURN)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileChoice = 3;
			pPM->SetCurrentProfile(3);
			m_nProfileType = SELECTED;
			m_nLRChoice = 0;
			m_nUDChoice = 0;
		}
		else if(m_nUDChoice == 4 && (pWii->IsButtonJustPressed(WII_A) || pDI->KeyPressed(DIK_RETURN)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileChoice = 4;
			pPM->SetCurrentProfile(4);
			m_nProfileType = SELECTED;
			m_nLRChoice = 0;
			m_nUDChoice = 0;
		}

		if(pDI->KeyPressed(DIK_UP) || pWii->IsButtonJustPressed(WII_UP))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice--;
		}
		else if(pDI->KeyPressed(DIK_DOWN) || pWii->IsButtonJustPressed(WII_DOWN))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice++;
		}

		if(m_nUDChoice > pPM->GetNumberOfProfiles()-1) 
			m_nUDChoice = 0;
		else if(m_nUDChoice < 0) 
			m_nUDChoice = pPM->GetNumberOfProfiles()-1;
	}
	else if(m_nProfileType == 0)
	{//no profile has been selected
		if(m_nLRChoice == 0 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			m_nProfileType = NEW;
		}		
		else if(m_nLRChoice == 1 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			if(pPM->GetNumberOfProfiles() != 0)
				m_nProfileType = OLD;
		}

		if(pDI->KeyPressed(DIK_LEFT) || pWii->IsButtonJustPressed(WII_LEFT))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nLRChoice--;
		}
		else if(pDI->KeyPressed(DIK_RIGHT) || pWii->IsButtonJustPressed(WII_RIGHT))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nLRChoice++;
		}

		if(m_nLRChoice > 1) 
			m_nLRChoice = 0;
		else if(m_nLRChoice < 0) 
			m_nLRChoice = 1;

	}
	else if(m_nProfileType == SELECTED)
	{//a profile has been selected
		if(pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			if(m_nUDChoice == 0)
			{
				m_bExitingToGame = true;
			}
			else if(m_nUDChoice == 1)
			{
				pPM->RemoveProfile(pPM->GetCurrentProfile());
				m_nProfileType = 0;
				m_nUDChoice = 0;
			}
			else if(m_nUDChoice == 2)
			{
				m_bItsThemeTime = true;
				m_nProfileType = THEMES;
				m_nUDChoice = 0;
			}
			else if(m_nUDChoice == 3 && (m_bShowCustomize || m_bShowCustom))
			{
				//m_nProfileType = CUSTOMIZE;
				CGame::GetInstance()->ChangeState(CCustomizeState::GetInstance());
				m_nUDChoice = 0;
			}
		}

		if(pDI->KeyPressed(DIK_UP) || pWii->IsButtonJustPressed(WII_UP))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice--;
		}
		else if(pDI->KeyPressed(DIK_DOWN) || pWii->IsButtonJustPressed(WII_DOWN))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice++;
		}


		if(m_bShowCustomize || m_bShowCustom)
		{
			if(m_nUDChoice > 3) 
				m_nUDChoice = 0;
			else if(m_nUDChoice < 0) 
				m_nUDChoice = 3;
		}
		else
		{		
			if(m_nUDChoice > 2) 
				m_nUDChoice = 0;
			else if(m_nUDChoice < 0) 
				m_nUDChoice = 2;
		}

		if(pDI->KeyDown(DIK_B))
			m_bShowCustomize = true;
		else
			m_bShowCustomize = false;

		if(pDI->KeyPressed(DIK_C))
			m_bShowCustom = !m_bShowCustom;

	}
	else if(m_bItsThemeTime)
	{
		if(pDI->KeyPressed(DIK_UP) || pWii->IsButtonJustPressed(WII_UP))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice--;
		}
		else if(pDI->KeyPressed(DIK_DOWN) || pWii->IsButtonJustPressed(WII_DOWN))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_MOVE);
			m_nUDChoice++;
		}

		if(m_nUDChoice > 3) 
			m_nUDChoice = 0;
		else if(m_nUDChoice < 0) 
			m_nUDChoice = 3;

		if(m_nUDChoice == 0 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			pPM->SetCurrentTheme(NORMAL);
			m_nUDChoice = 0;
			m_nProfileType = SELECTED;
			m_bItsThemeTime = false;
		}
		else if(m_nUDChoice == 1 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			pPM->SetCurrentTheme(LEGO);
			m_nUDChoice = 0;
			m_nProfileType = SELECTED;
			m_bItsThemeTime = false;
		}
		else if(m_nUDChoice == 2 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			pPM->SetCurrentTheme(BLACK_WHITE);
			m_nUDChoice = 0;
			m_nProfileType = SELECTED;
			m_bItsThemeTime = false;
		}
		else if(m_nUDChoice == 3 && (pDI->KeyPressed(DIK_RETURN) || pWii->IsButtonJustPressed(WII_A)))
		{
			CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
			pPM->SetCurrentTheme(PHAT_BEATS);
			m_nUDChoice = 0;
			m_nProfileType = SELECTED;
			m_bItsThemeTime = false;
		}
	}

	if(pWii->IsButtonJustPressed(WII_HOME) || pDI->KeyPressed(DIK_ESCAPE))
	{
		CSoundManager::GetInstance()->PlaySoundIndxUnBuffered(SOUND_MENU_SELECT);
		if (m_nProfileType == THEMES)
		{
			m_bItsThemeTime = false;
			m_nProfileType = SELECTED;
		}
		else if (m_nProfileType == SELECTED)
		{
			m_nProfileType = OLD;
		}
		else 
		{
			m_bExitingToMain = true;
		}
	}

	///Close door then change state///////////////////////////////////////////
	if (m_bExitingToGame)
	{
		CTransitionScreen::GetInstance()->ChangeTo(CLevelSelectState::GetInstance()); 
	}

	if (m_bExitingToMain)
	{
		CTransitionScreen::GetInstance()->ChangeTo(CMainMenuState::GetInstance()); 	
	}
	//////////////////////////////////////////////////////////////////////////


	return true;
}

void CProfileSelectState::Update(float fElapsedTime)
{
}

void CProfileSelectState::Render()
{
	CBitmapFontEngine* pBFE = CBitmapFontEngine::GetInstance();
	CProfileManager* pPM = CProfileManager::GetInstance();

	m_cScreen.RenderScreen();

	
	int TopX= m_cScreen.GetPosObjMembers("Top",XPOS);
	int TopY= m_cScreen.GetPosObjMembers("Top",YPOS);

	int LeftX = m_cScreen.GetPosObjMembers("Left",XPOS);
	int LeftY = m_cScreen.GetPosObjMembers("Left",YPOS);

	int RightX = m_cScreen.GetPosObjMembers("Right",XPOS);
	int RightY = m_cScreen.GetPosObjMembers("Right",YPOS);

	if(!m_bItsThemeTime)
	{
		if(m_nProfileType == 0 && m_nLRChoice == 0)
		{
			pBFE->RenderString("New Profile?", m_nFontID, 0, 0xff00ff00, TopX, TopY+5, 0);
			pBFE->RenderString("Yes", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), TopX+64, TopY+50, 0);
			pBFE->RenderString("No", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), TopX+256, TopY+50, 0);
		}
		else if(m_nProfileType == 0 && m_nLRChoice == 1)
		{
			pBFE->RenderString("New Profile?", m_nFontID, 0, 0xff00ff00, TopX, TopY+5, 0);
			pBFE->RenderString("Yes", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), TopX+64, TopY+50, 0);
			pBFE->RenderString("No", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), TopX+256, TopY+50, 0);
		}
		else if(m_nProfileType == NEW)
		{
			pBFE->RenderString("Enter name:", m_nFontID, 0, 0xff00ff00, TopX, TopY+5, 0);
			m_cTextBox.SetPosX(TopX);
			m_cTextBox.SetPosY(TopY+50);
			m_cTextBox.SetTextLimit(7);
			m_cTextBox.Render();
		}

		int profile1y = LeftY+40;
		int profile2y = LeftY+75;
		int profile3y = LeftY+110;
		int profile4y = LeftY+145;
		int profile5y = LeftY+180;

		if(m_nProfileType != SELECTED)
		{
			DWORD dwYellow = D3DCOLOR_XRGB(0, 255, 0);
			int CursorX = 70;
			int ProfileX = 90;
			pBFE->RenderString("Name:        Score:", m_nFontID, 0, 0xff00ff00, LeftX, LeftY, 0);

			if(m_nUDChoice == 0 && pPM->GetNumberOfProfiles() > 0)
			{
				if(m_nProfileType == OLD)
				{
					dwYellow = D3DCOLOR_XRGB(255, 255, 0);
				}

				pPM->RenderProfile(ProfileX, profile1y, 0, dwYellow);
				pPM->RenderScore(RightX,profile1y,0,dwYellow);
				if(pPM->GetNumberOfProfiles() > 1) 
				{
					pPM->RenderProfile(ProfileX, profile2y, 1, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile2y,1, D3DCOLOR_XRGB(0, 255, 0));
				}
				if(pPM->GetNumberOfProfiles() > 2) 
				{
					pPM->RenderProfile(ProfileX, profile3y, 2, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile3y,2, D3DCOLOR_XRGB(0, 255, 0));
				}
				if(pPM->GetNumberOfProfiles() > 3) 

				{
					pPM->RenderProfile(ProfileX, profile4y, 3, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile4y,3, D3DCOLOR_XRGB(0, 255, 0));

				}
				if(pPM->GetNumberOfProfiles() > 4) 
				{
					pPM->RenderProfile(ProfileX, profile5y, 4, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile5y,4, D3DCOLOR_XRGB(0, 255, 0));
				}

			}
			else if(m_nUDChoice == 1 && pPM->GetNumberOfProfiles() > 1)
			{
				if(m_nProfileType == OLD)
				{
					dwYellow = D3DCOLOR_XRGB(255, 255, 0);
				}

				pPM->RenderProfile(ProfileX, profile1y, 0, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile1y,0,D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderProfile(ProfileX, profile2y, 1, dwYellow);
				pPM->RenderScore(RightX,profile2y,1,dwYellow);
				if(pPM->GetNumberOfProfiles() > 2) 
				{
					pPM->RenderProfile(ProfileX, profile3y, 2, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile3y,2,D3DCOLOR_XRGB(0, 255, 0));
				}if(pPM->GetNumberOfProfiles() > 3) 
				{
					pPM->RenderProfile(ProfileX, profile4y, 3, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile4y,3,D3DCOLOR_XRGB(0, 255, 0));
				}if(pPM->GetNumberOfProfiles() > 4) 
				{
					pPM->RenderProfile(ProfileX, profile5y, 4, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile5y,4,D3DCOLOR_XRGB(0, 255, 0));
				}
			}
			else if(m_nUDChoice == 2 && pPM->GetNumberOfProfiles() > 2)
			{
				if(m_nProfileType == OLD)
				{
					dwYellow = D3DCOLOR_XRGB(255, 255, 0);
				}

				pPM->RenderProfile(ProfileX, profile1y, 0, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile1y,0,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile2y, 1, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile2y,1,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile3y, 2, dwYellow);
				pPM->RenderScore(RightX,profile3y,2,dwYellow);

				if(pPM->GetNumberOfProfiles() > 3) 
				{
					pPM->RenderProfile(ProfileX, profile4y, 3, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile4y,3,D3DCOLOR_XRGB(0, 255, 0));
				}
				if(pPM->GetNumberOfProfiles() > 4) 
				{
					pPM->RenderProfile(ProfileX, profile5y, 4, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile5y,4,D3DCOLOR_XRGB(0, 255, 0));
				}
			}
			else if(m_nUDChoice == 3 && pPM->GetNumberOfProfiles() > 3)
			{
				if(m_nProfileType == OLD)
				{
					dwYellow = D3DCOLOR_XRGB(255, 255, 0);
				}

				pPM->RenderProfile(ProfileX, profile1y, 0, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile1y,0,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile2y, 1, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile2y,1,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile3y, 2, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile3y,2,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile4y, 3, dwYellow);
				pPM->RenderScore(RightX,profile4y,3,dwYellow);

				if(pPM->GetNumberOfProfiles() > 4) 
				{
					pPM->RenderProfile(ProfileX, profile5y, 4, D3DCOLOR_XRGB(0, 255, 0));
					pPM->RenderScore(RightX,profile5y,4,D3DCOLOR_XRGB(0, 255, 0));
				}
			}
			else if(m_nUDChoice == 4 && pPM->GetNumberOfProfiles() > 4)
			{
				if(m_nProfileType == OLD)
				{
					dwYellow = D3DCOLOR_XRGB(255, 255, 0);
				}

				pPM->RenderProfile(ProfileX, profile1y, 0, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile1y,0,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile2y, 1, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile2y,1,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile3y, 2, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile3y,2,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile4y, 3, D3DCOLOR_XRGB(0, 255, 0));
				pPM->RenderScore(RightX,profile4y,3,D3DCOLOR_XRGB(0, 255, 0));

				pPM->RenderProfile(ProfileX, profile5y, 4, dwYellow);
				pPM->RenderScore(RightX,profile5y,4,dwYellow);

			}
		}
		else if(m_nProfileType == SELECTED)
		{
			pPM->RenderProfile(TopX, TopY+25, m_nProfileChoice, D3DCOLOR_XRGB(0, 255, 0));
			pPM->RenderScore(TopX+224,TopY+25,m_nProfileChoice,D3DCOLOR_XRGB(0,255,0));

			if(m_nUDChoice == 0)
			{
				pBFE->RenderString("Play", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), LeftX+15, LeftY+55, 0, .8f);
				pBFE->RenderString("Delete", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+90, 0, .8f);
				pBFE->RenderString("Themes", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+125, 0, .8f);
				if(m_bShowCustomize || m_bShowCustom)
					pBFE->RenderString("Customize", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+160, 0, .8f);
			}
			else if(m_nUDChoice == 1)
			{		
				pBFE->RenderString("Play", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+55, 0, .8f);
				pBFE->RenderString("Delete", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), LeftX+15, LeftY+90, 0, .8f);
				pBFE->RenderString("Themes", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+125, 0, .8f);
				if(m_bShowCustomize || m_bShowCustom)
					pBFE->RenderString("Customize", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+160, 0, .8f);
			}
			else if(m_nUDChoice == 2)
			{		
				pBFE->RenderString("Play", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+55, 0, .8f);
				pBFE->RenderString("Delete", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+90, 0, .8f);
				pBFE->RenderString("Themes", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), LeftX+15, LeftY+125, 0, .8f);
				if(m_bShowCustomize || m_bShowCustom)
					pBFE->RenderString("Customize", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+160, 0, .8f);
			}
			else if(m_nUDChoice == 3)
			{		
				pBFE->RenderString("Play", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+55, 0, .8f);
				pBFE->RenderString("Delete", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+90, 0, .8f);
				pBFE->RenderString("Themes", m_nFontID, 0, D3DCOLOR_XRGB(0, 255, 0), LeftX+15, LeftY+125, 0, .8f);
				pBFE->RenderString("Customize", m_nFontID, 0, D3DCOLOR_XRGB(255, 255, 0), LeftX+15, LeftY+160, 0, .8f);
			}
		}
	}
	else if(m_bItsThemeTime)
	{	
		pBFE->RenderString("Themes", m_nFontID, 0, 0xff00ff00, TopX+85, TopY+35, 0);
			
		RECT rRect;
		rRect.top = 0;
		rRect.left = 32;
		rRect.right = 256;
		rRect.bottom = 96;
		
		RECT rRect2;
		rRect2.top = 0;
		rRect2.left = 256;
		rRect2.right = 480;
		rRect2.bottom = 64;

		switch(m_nUDChoice)
		{
		case 0://normal
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+35, 1, 1, &rRect);
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+130, 1, 1, &rRect2);
			pBFE->RenderString("Normal", m_nFontID, 0, 0xffffff00, LeftX, LeftY+15, 0);
			pBFE->RenderString("Black &", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+55, 0);
			pBFE->RenderString("White", m_nFontID, 0, 0xff00ff00, LeftX+35, LeftY+95, 0);
			pBFE->RenderString("Mario", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+135, 0);
			pBFE->RenderString("Neon", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+175, 0);
			break;
		case 1://black/white
			rRect.top = 96;
			rRect.bottom = 192;
			rRect2.top = 96;
			rRect2.bottom = 160;
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+35, 1, 1, &rRect);
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+130, 1, 1, &rRect2);
			pBFE->RenderString("Normal", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+15, 0);
			pBFE->RenderString("Black &", m_nFontID, 0, 0xffffff00, LeftX, LeftY+55, 0);
			pBFE->RenderString("White", m_nFontID, 0, 0xffffff00, LeftX+35, LeftY+95, 0);
			pBFE->RenderString("Mario", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+135, 0);
			pBFE->RenderString("Neon", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+175, 0);
			break;
		case 2://mario
			rRect.top = 192;
			rRect.bottom = 288;
			rRect2.top = 192;
			rRect2.bottom = 256;
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+35, 1, 1, &rRect);
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+130, 1, 1, &rRect2);
			pBFE->RenderString("Normal", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+15, 0);
			pBFE->RenderString("Black &", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+55, 0);
			pBFE->RenderString("White", m_nFontID, 0, 0xff00ff00, LeftX+35, LeftY+95, 0);
			pBFE->RenderString("Mario", m_nFontID, 0, 0xffffff00, LeftX, LeftY+135, 0);
			pBFE->RenderString("Neon", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+175, 0);
			break;
		case 3://neon
			rRect.top = 288;
			rRect.bottom = 384;
			rRect2.top = 288;
			rRect2.bottom = 352;
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+35, 1, 1, &rRect);
			CSGD_TextureManager::GetInstance()->Draw(m_nThemeID, RightX+10, RightY+130, 1, 1, &rRect2);
			pBFE->RenderString("Normal", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+15, 0);
			pBFE->RenderString("Black &", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+55, 0);
			pBFE->RenderString("White", m_nFontID, 0, 0xff00ff00, LeftX+35, LeftY+95, 0);
			pBFE->RenderString("Mario", m_nFontID, 0, 0xff00ff00, LeftX, LeftY+135, 0);
			pBFE->RenderString("Neon", m_nFontID, 0, 0xffffff00, LeftX, LeftY+175, 0);
			break;
		}
	}
}
	
